package com.ict.luxshare.bt_demo;

import android.app.Activity;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;

public class Empty extends Activity {
    private final static String TAG = "jb:Empty";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        JobInfo jobInfo;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Log.d(TAG, "onCreate()");
            JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                Log.d(TAG, "getPackageName()1:" + getPackageName());
                jobInfo = new JobInfo.Builder(BtJobService.REGISTER_BT_RECEIVER, new ComponentName(getPackageName(), BtJobService.class.getName()))
                        .setMinimumLatency(1000)
                        .build();
            } else {
                Log.d(TAG, "getPackageName()2:" + getPackageName());
                jobInfo = new JobInfo.Builder(BtJobService.REGISTER_BT_RECEIVER, new ComponentName(getPackageName(), BtJobService.class.getName()))
                        .setPeriodic(1000)
                        .build();
            }
            jobScheduler.schedule(jobInfo);
        }
        finish();
    }
}
